import { request } from '@/network/request.js'
// 创建班课
export const saveCourse = function (entity) {
  return request.post('/course', entity)
}
// 根据课程 id 来解散班课
export const removeCourse = function (id) {
  return request.delete(`/course/${id}`)
}
// 更新课程信息
export const updateCourse = function (id , entity) {
  return request.put(`/course/${id}`, entity)
}
// 按 id 查找课程
export const getCourse = function (id) {
  return request.get(`/course/${id}`)
}
// 分页查找课程
export const pageCourse = function (current, size, name = '') {
  return request.get(`/course/page?current=${current}&size=${size}&name=${name}`)
}

export const pageCourseForTeacher = function (current, size, name = '') {
  return request.get(`/course/teacher/page?current=${current}&size=${size}&name=${name}`)
}

export const pageCourseForStudent = function (current, size, name = '') {
  return request.get(`/course/student/page?current=${current}&size=${size}&name=${name}`)
}
// 开放课程
export const openCourse = function (id) {
  return request.put(`/course/open/${id}`)
}
// 关闭课程 
export const closeCourse = function (id) {
  return request.put(`/course/close/${id}`)
}
// 课程 结束
export const endCourse = function (id) {
  return request.put(`/course/end/${id}`)
}
// 分页查看班级成员
export const pageBankeMember = function (current, size, courseId) {
  return request.get(`/course/member/page?current=${current}&size=${size}&courseId=${courseId}`)
}